home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / lispref.info-28 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  48.8 KB  |  1,172 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo-1.63
  2. from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995
  12.  
  13.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  14. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  15. Copyright (C) 1995 Amdahl Corporation.  Copyright (C) 1995 Ben Wing.
  16.  
  17.    Permission is granted to make and distribute verbatim copies of this
  18. manual provided the copyright notice and this permission notice are
  19. preserved on all copies.
  20.  
  21.    Permission is granted to copy and distribute modified versions of
  22. this manual under the conditions for verbatim copying, provided that the
  23. entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that this permission notice may be stated in a
  29. translation approved by the Foundation.
  30.  
  31.    Permission is granted to copy and distribute modified versions of
  32. this manual under the conditions for verbatim copying, provided also
  33. that the section entitled "GNU General Public License" is included
  34. exactly as in the original, and provided that the entire resulting
  35. derived work is distributed under the terms of a permission notice
  36. identical to this one.
  37.  
  38.    Permission is granted to copy and distribute translations of this
  39. manual into another language, under the above conditions for modified
  40. versions, except that the section entitled "GNU General Public License"
  41. may be included in a translation approved by the Free Software
  42. Foundation instead of in the original English.
  43.  
  44. 
  45. File: lispref.info,  Node: Searching and Matching,  Next: Syntax Tables,  Prev: Text,  Up: Top
  46.  
  47. Searching and Matching
  48. **********************
  49.  
  50.    XEmacs provides two ways to search through a buffer for specified
  51. text: exact string searches and regular expression searches.  After a
  52. regular expression search, you can examine the "match data" to
  53. determine which text matched the whole regular expression or various
  54. portions of it.
  55.  
  56. * Menu:
  57.  
  58. * String Search::         Search for an exact match.
  59. * Regular Expressions::   Describing classes of strings.
  60. * Regexp Search::         Searching for a match for a regexp.
  61. * POSIX Regexps::         Searching POSIX-style for the longest match.
  62. * Search and Replace::      Internals of `query-replace'.
  63. * Match Data::            Finding out which part of the text matched
  64.                             various parts of a regexp, after regexp search.
  65. * Searching and Case::    Case-independent or case-significant searching.
  66. * Standard Regexps::      Useful regexps for finding sentences, pages,...
  67.  
  68.    The `skip-chars...' functions also perform a kind of searching.
  69. *Note Skipping Characters::.
  70.  
  71. 
  72. File: lispref.info,  Node: String Search,  Next: Regular Expressions,  Up: Searching and Matching
  73.  
  74. Searching for Strings
  75. =====================
  76.  
  77.    These are the primitive functions for searching through the text in a
  78. buffer.  They are meant for use in programs, but you may call them
  79. interactively.  If you do so, they prompt for the search string; LIMIT
  80. and NOERROR are set to `nil', and REPEAT is set to 1.
  81.  
  82.  - Command: search-forward STRING &optional LIMIT NOERROR REPEAT
  83.      This function searches forward from point for an exact match for
  84.      STRING.  If successful, it sets point to the end of the occurrence
  85.      found, and returns the new value of point.  If no match is found,
  86.      the value and side effects depend on NOERROR (see below).
  87.  
  88.      In the following example, point is initially at the beginning of
  89.      the line.  Then `(search-forward "fox")' moves point after the last
  90.      letter of `fox':
  91.  
  92.           ---------- Buffer: foo ----------
  93.           -!-The quick brown fox jumped over the lazy dog.
  94.           ---------- Buffer: foo ----------
  95.           
  96.           (search-forward "fox")
  97.                => 20
  98.           
  99.           ---------- Buffer: foo ----------
  100.           The quick brown fox-!- jumped over the lazy dog.
  101.           ---------- Buffer: foo ----------
  102.  
  103.      The argument LIMIT specifies the upper bound to the search.  (It
  104.      must be a position in the current buffer.)  No match extending
  105.      after that position is accepted.  If LIMIT is omitted or `nil', it
  106.      defaults to the end of the accessible portion of the buffer.
  107.  
  108.      What happens when the search fails depends on the value of
  109.      NOERROR.  If NOERROR is `nil', a `search-failed' error is
  110.      signaled.  If NOERROR is `t', `search-forward' returns `nil' and
  111.      does nothing.  If NOERROR is neither `nil' nor `t', then
  112.      `search-forward' moves point to the upper bound and returns `nil'.
  113.      (It would be more consistent now to return the new position of
  114.      point in that case, but some programs may depend on a value of
  115.      `nil'.)
  116.  
  117.      If REPEAT is supplied (it must be a positive number), then the
  118.      search is repeated that many times (each time starting at the end
  119.      of the previous time's match).  If these successive searches
  120.      succeed, the function succeeds, moving point and returning its new
  121.      value.  Otherwise the search fails.
  122.  
  123.  - Command: search-backward STRING &optional LIMIT NOERROR REPEAT
  124.      This function searches backward from point for STRING.  It is just
  125.      like `search-forward' except that it searches backwards and leaves
  126.      point at the beginning of the match.
  127.  
  128.  - Command: word-search-forward STRING &optional LIMIT NOERROR REPEAT
  129.      This function searches forward from point for a "word" match for
  130.      STRING.  If it finds a match, it sets point to the end of the
  131.      match found, and returns the new value of point.
  132.  
  133.      Word matching regards STRING as a sequence of words, disregarding
  134.      punctuation that separates them.  It searches the buffer for the
  135.      same sequence of words.  Each word must be distinct in the buffer
  136.      (searching for the word `ball' does not match the word `balls'),
  137.      but the details of punctuation and spacing are ignored (searching
  138.      for `ball boy' does match `ball.  Boy!').
  139.  
  140.      In this example, point is initially at the beginning of the
  141.      buffer; the search leaves it between the `y' and the `!'.
  142.  
  143.           ---------- Buffer: foo ----------
  144.           -!-He said "Please!  Find
  145.           the ball boy!"
  146.           ---------- Buffer: foo ----------
  147.           
  148.           (word-search-forward "Please find the ball, boy.")
  149.                => 35
  150.           
  151.           ---------- Buffer: foo ----------
  152.           He said "Please!  Find
  153.           the ball boy-!-!"
  154.           ---------- Buffer: foo ----------
  155.  
  156.      If LIMIT is non-`nil' (it must be a position in the current
  157.      buffer), then it is the upper bound to the search.  The match
  158.      found must not extend after that position.
  159.  
  160.      If NOERROR is `nil', then `word-search-forward' signals an error
  161.      if the search fails.  If NOERROR is `t', then it returns `nil'
  162.      instead of signaling an error.  If NOERROR is neither `nil' nor
  163.      `t', it moves point to LIMIT (or the end of the buffer) and
  164.      returns `nil'.
  165.  
  166.      If REPEAT is non-`nil', then the search is repeated that many
  167.      times.  Point is positioned at the end of the last match.
  168.  
  169.  - Command: word-search-backward STRING &optional LIMIT NOERROR REPEAT
  170.      This function searches backward from point for a word match to
  171.      STRING.  This function is just like `word-search-forward' except
  172.      that it searches backward and normally leaves point at the
  173.      beginning of the match.
  174.  
  175. 
  176. File: lispref.info,  Node: Regular Expressions,  Next: Regexp Search,  Prev: String Search,  Up: Searching and Matching
  177.  
  178. Regular Expressions
  179. ===================
  180.  
  181.    A "regular expression" ("regexp", for short) is a pattern that
  182. denotes a (possibly infinite) set of strings.  Searching for matches for
  183. a regexp is a very powerful operation.  This section explains how to
  184. write regexps; the following section says how to search for them.
  185.  
  186. * Menu:
  187.  
  188. * Syntax of Regexps::       Rules for writing regular expressions.
  189. * Regexp Example::          Illustrates regular expression syntax.
  190.  
  191. 
  192. File: lispref.info,  Node: Syntax of Regexps,  Next: Regexp Example,  Up: Regular Expressions
  193.  
  194. Syntax of Regular Expressions
  195. -----------------------------
  196.  
  197.    Regular expressions have a syntax in which a few characters are
  198. special constructs and the rest are "ordinary".  An ordinary character
  199. is a simple regular expression that matches that character and nothing
  200. else.  The special characters are `.', `*', `+', `?', `[', `]', `^',
  201. `$', and `\'; no new special characters will be defined in the future.
  202. Any other character appearing in a regular expression is ordinary,
  203. unless a `\' precedes it.
  204.  
  205.    For example, `f' is not a special character, so it is ordinary, and
  206. therefore `f' is a regular expression that matches the string `f' and
  207. no other string.  (It does *not* match the string `ff'.)  Likewise, `o'
  208. is a regular expression that matches only `o'.
  209.  
  210.    Any two regular expressions A and B can be concatenated.  The result
  211. is a regular expression that matches a string if A matches some amount
  212. of the beginning of that string and B matches the rest of the string.
  213.  
  214.    As a simple example, we can concatenate the regular expressions `f'
  215. and `o' to get the regular expression `fo', which matches only the
  216. string `fo'.  Still trivial.  To do something more powerful, you need
  217. to use one of the special characters.  Here is a list of them:
  218.  
  219. `. (Period)'
  220.      is a special character that matches any single character except a
  221.      newline.  Using concatenation, we can make regular expressions
  222.      like `a.b', which matches any three-character string that begins
  223.      with `a' and ends with `b'.
  224.  
  225. `*'
  226.      is not a construct by itself; it is a suffix operator that means to
  227.      repeat the preceding regular expression as many times as possible.
  228.      In `fo*', the `*' applies to the `o', so `fo*' matches one `f'
  229.      followed by any number of `o's.  The case of zero `o's is allowed:
  230.      `fo*' does match `f'.
  231.  
  232.      `*' always applies to the *smallest* possible preceding
  233.      expression.  Thus, `fo*' has a repeating `o', not a repeating `fo'.
  234.  
  235.      The matcher processes a `*' construct by matching, immediately, as
  236.      many repetitions as can be found.  Then it continues with the rest
  237.      of the pattern.  If that fails, backtracking occurs, discarding
  238.      some of the matches of the `*'-modified construct in case that
  239.      makes it possible to match the rest of the pattern.  For example,
  240.      in matching `ca*ar' against the string `caaar', the `a*' first
  241.      tries to match all three `a's; but the rest of the pattern is `ar'
  242.      and there is only `r' left to match, so this try fails.  The next
  243.      alternative is for `a*' to match only two `a's.  With this choice,
  244.      the rest of the regexp matches successfully.
  245.  
  246.      Nested repetition operators can be extremely slow if they specify
  247.      backtracking loops.  For example, it could take hours for the
  248.      regular expression `\(x+y*\)*a' to match the sequence
  249.      `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz'.  The slowness is because
  250.      Emacs must try each imaginable way of grouping the 35 `x''s before
  251.      concluding that none of them can work.  To make sure your regular
  252.      expressions run fast, check nested repetitions carefully.
  253.  
  254. `+'
  255.      is a suffix operator similar to `*' except that the preceding
  256.      expression must match at least once.  So, for example, `ca+r'
  257.      matches the strings `car' and `caaaar' but not the string `cr',
  258.      whereas `ca*r' matches all three strings.
  259.  
  260. `?'
  261.      is a suffix operator similar to `*' except that the preceding
  262.      expression can match either once or not at all.  For example,
  263.      `ca?r' matches `car' or `cr', but does not match anyhing else.
  264.  
  265. `[ ... ]'
  266.      `[' begins a "character set", which is terminated by a `]'.  In
  267.      the simplest case, the characters between the two brackets form
  268.      the set.  Thus, `[ad]' matches either one `a' or one `d', and
  269.      `[ad]*' matches any string composed of just `a's and `d's
  270.      (including the empty string), from which it follows that `c[ad]*r'
  271.      matches `cr', `car', `cdr', `caddaar', etc.
  272.  
  273.      The usual regular expression special characters are not special
  274.      inside a character set.  A completely different set of special
  275.      characters exists inside character sets: `]', `-' and `^'.
  276.  
  277.      `-' is used for ranges of characters.  To write a range, write two
  278.      characters with a `-' between them.  Thus, `[a-z]' matches any
  279.      lower case letter.  Ranges may be intermixed freely with individual
  280.      characters, as in `[a-z$%.]', which matches any lower case letter
  281.      or `$', `%', or a period.
  282.  
  283.      To include a `]' in a character set, make it the first character.
  284.      For example, `[]a]' matches `]' or `a'.  To include a `-', write
  285.      `-' as the first character in the set, or put it immediately after
  286.      a range.  (You can replace one individual character C with the
  287.      range `C-C' to make a place to put the `-'.)  There is no way to
  288.      write a set containing just `-' and `]'.
  289.  
  290.      To include `^' in a set, put it anywhere but at the beginning of
  291.      the set.
  292.  
  293. `[^ ... ]'
  294.      `[^' begins a "complement character set", which matches any
  295.      character except the ones specified.  Thus, `[^a-z0-9A-Z]' matches
  296.      all characters *except* letters and digits.
  297.  
  298.      `^' is not special in a character set unless it is the first
  299.      character.  The character following the `^' is treated as if it
  300.      were first (thus, `-' and `]' are not special there).
  301.  
  302.      Note that a complement character set can match a newline, unless
  303.      newline is mentioned as one of the characters not to match.
  304.  
  305. `^'
  306.      is a special character that matches the empty string, but only at
  307.      the beginning of a line in the text being matched.  Otherwise it
  308.      fails to match anything.  Thus, `^foo' matches a `foo' that occurs
  309.      at the beginning of a line.
  310.  
  311.      When matching a string instead of a buffer, `^' matches at the
  312.      beginning of the string or after a newline character `\n'.
  313.  
  314. `$'
  315.      is similar to `^' but matches only at the end of a line.  Thus,
  316.      `x+$' matches a string of one `x' or more at the end of a line.
  317.  
  318.      When matching a string instead of a buffer, `$' matches at the end
  319.      of the string or before a newline character `\n'.
  320.  
  321. `\'
  322.      has two functions: it quotes the special characters (including
  323.      `\'), and it introduces additional special constructs.
  324.  
  325.      Because `\' quotes special characters, `\$' is a regular
  326.      expression that matches only `$', and `\[' is a regular expression
  327.      that matches only `[', and so on.
  328.  
  329.      Note that `\' also has special meaning in the read syntax of Lisp
  330.      strings (*note String Type::.), and must be quoted with `\'.  For
  331.      example, the regular expression that matches the `\' character is
  332.      `\\'.  To write a Lisp string that contains the characters `\\',
  333.      Lisp syntax requires you to quote each `\' with another `\'.
  334.      Therefore, the read syntax for a regular expression matching `\'
  335.      is `"\\\\"'.
  336.  
  337.    *Please note:* For historical compatibility, special characters are
  338. treated as ordinary ones if they are in contexts where their special
  339. meanings make no sense.  For example, `*foo' treats `*' as ordinary
  340. since there is no preceding expression on which the `*' can act.  It is
  341. poor practice to depend on this behavior; quote the special character
  342. anyway, regardless of where it appears.
  343.  
  344.    For the most part, `\' followed by any character matches only that
  345. character.  However, there are several exceptions: characters that,
  346. when preceded by `\', are special constructs.  Such characters are
  347. always ordinary when encountered on their own.  Here is a table of `\'
  348. constructs:
  349.  
  350. `\|'
  351.      specifies an alternative.  Two regular expressions A and B with
  352.      `\|' in between form an expression that matches anything that
  353.      either A or B matches.
  354.  
  355.      Thus, `foo\|bar' matches either `foo' or `bar' but no other string.
  356.  
  357.      `\|' applies to the largest possible surrounding expressions.
  358.      Only a surrounding `\( ... \)' grouping can limit the grouping
  359.      power of `\|'.
  360.  
  361.      Full backtracking capability exists to handle multiple uses of
  362.      `\|'.
  363.  
  364. `\( ... \)'
  365.      is a grouping construct that serves three purposes:
  366.  
  367.        1. To enclose a set of `\|' alternatives for other operations.
  368.           Thus, `\(foo\|bar\)x' matches either `foox' or `barx'.
  369.  
  370.        2. To enclose an expression for a suffix operator such as `*' to
  371.           act on.  Thus, `ba\(na\)*' matches `bananana', etc., with any
  372.           (zero or more) number of `na' strings.
  373.  
  374.        3. To record a matched substring for future reference.
  375.  
  376.      This last application is not a consequence of the idea of a
  377.      parenthetical grouping; it is a separate feature that happens to be
  378.      assigned as a second meaning to the same `\( ... \)' construct
  379.      because there is no conflict in practice between the two meanings.
  380.      Here is an explanation of this feature:
  381.  
  382. `\DIGIT'
  383.      matches the same text that matched the DIGITth occurrence of a `\(
  384.      ... \)' construct.
  385.  
  386.      In other words, after the end of a `\( ... \)' construct.  the
  387.      matcher remembers the beginning and end of the text matched by that
  388.      construct.  Then, later on in the regular expression, you can use
  389.      `\' followed by DIGIT to match that same text, whatever it may
  390.      have been.
  391.  
  392.      The strings matching the first nine `\( ... \)' constructs
  393.      appearing in a regular expression are assigned numbers 1 through 9
  394.      in the order that the open parentheses appear in the regular
  395.      expression.  So you can use `\1' through `\9' to refer to the text
  396.      matched by the corresponding `\( ... \)' constructs.
  397.  
  398.      For example, `\(.*\)\1' matches any newline-free string that is
  399.      composed of two identical halves.  The `\(.*\)' matches the first
  400.      half, which may be anything, but the `\1' that follows must match
  401.      the same exact text.
  402.  
  403. `\w'
  404.      matches any word-constituent character.  The editor syntax table
  405.      determines which characters these are.  *Note Syntax Tables::.
  406.  
  407. `\W'
  408.      matches any character that is not a word constituent.
  409.  
  410. `\sCODE'
  411.      matches any character whose syntax is CODE.  Here CODE is a
  412.      character that represents a syntax code: thus, `w' for word
  413.      constituent, `-' for whitespace, `(' for open parenthesis, etc.
  414.      *Note Syntax Tables::, for a list of syntax codes and the
  415.      characters that stand for them.
  416.  
  417. `\SCODE'
  418.      matches any character whose syntax is not CODE.
  419.  
  420.    The following regular expression constructs match the empty
  421. string--that is, they don't use up any characters--but whether they
  422. match depends on the context.
  423.  
  424. `\`'
  425.      matches the empty string, but only at the beginning of the buffer
  426.      or string being matched against.
  427.  
  428. `\''
  429.      matches the empty string, but only at the end of the buffer or
  430.      string being matched against.
  431.  
  432. `\='
  433.      matches the empty string, but only at point.  (This construct is
  434.      not defined when matching against a string.)
  435.  
  436. `\b'
  437.      matches the empty string, but only at the beginning or end of a
  438.      word.  Thus, `\bfoo\b' matches any occurrence of `foo' as a
  439.      separate word.  `\bballs?\b' matches `ball' or `balls' as a
  440.      separate word.
  441.  
  442. `\B'
  443.      matches the empty string, but *not* at the beginning or end of a
  444.      word.
  445.  
  446. `\<'
  447.      matches the empty string, but only at the beginning of a word.
  448.  
  449. `\>'
  450.      matches the empty string, but only at the end of a word.
  451.  
  452.    Not every string is a valid regular expression.  For example, a
  453. string with unbalanced square brackets is invalid (with a few
  454. exceptions, such as `[]]'), and so is a string that ends with a single
  455. `\'.  If an invalid regular expression is passed to any of the search
  456. functions, an `invalid-regexp' error is signaled.
  457.  
  458.  - Function: regexp-quote STRING
  459.      This function returns a regular expression string that matches
  460.      exactly STRING and nothing else.  This allows you to request an
  461.      exact string match when calling a function that wants a regular
  462.      expression.
  463.  
  464.           (regexp-quote "^The cat$")
  465.                => "\\^The cat\\$"
  466.  
  467.      One use of `regexp-quote' is to combine an exact string match with
  468.      context described as a regular expression.  For example, this
  469.      searches for the string that is the value of `string', surrounded
  470.      by whitespace:
  471.  
  472.           (re-search-forward
  473.            (concat "\\s-" (regexp-quote string) "\\s-"))
  474.  
  475. 
  476. File: lispref.info,  Node: Regexp Example,  Prev: Syntax of Regexps,  Up: Regular Expressions
  477.  
  478. Complex Regexp Example
  479. ----------------------
  480.  
  481.    Here is a complicated regexp, used by XEmacs to recognize the end of
  482. a sentence together with any whitespace that follows.  It is the value
  483. of the variable `sentence-end'.
  484.  
  485.    First, we show the regexp as a string in Lisp syntax to distinguish
  486. spaces from tab characters.  The string constant begins and ends with a
  487. double-quote.  `\"' stands for a double-quote as part of the string,
  488. `\\' for a backslash as part of the string, `\t' for a tab and `\n' for
  489. a newline.
  490.  
  491.      "[.?!][]\"')}]*\\($\\| $\\|\t\\|  \\)[ \t\n]*"
  492.  
  493.    In contrast, if you evaluate the variable `sentence-end', you will
  494. see the following:
  495.  
  496.      sentence-end
  497.      =>
  498.      "[.?!][]\"')}]*\\($\\| $\\|  \\|  \\)[
  499.      ]*"
  500.  
  501. In this output, tab and newline appear as themselves.
  502.  
  503.    This regular expression contains four parts in succession and can be
  504. deciphered as follows:
  505.  
  506. `[.?!]'
  507.      The first part of the pattern is a character set that matches any
  508.      one of three characters: period, question mark, and exclamation
  509.      mark.  The match must begin with one of these three characters.
  510.  
  511. `[]\"')}]*'
  512.      The second part of the pattern matches any closing braces and
  513.      quotation marks, zero or more of them, that may follow the period,
  514.      question mark or exclamation mark.  The `\"' is Lisp syntax for a
  515.      double-quote in a string.  The `*' at the end indicates that the
  516.      immediately preceding regular expression (a character set, in this
  517.      case) may be repeated zero or more times.
  518.  
  519. `\\($\\| $\\|\t\\|  \\)'
  520.      The third part of the pattern matches the whitespace that follows
  521.      the end of a sentence: the end of a line, or a tab, or two spaces.
  522.      The double backslashes mark the parentheses and vertical bars as
  523.      regular expression syntax; the parentheses delimit a group and the
  524.      vertical bars separate alternatives.  The dollar sign is used to
  525.      match the end of a line.
  526.  
  527. `[ \t\n]*'
  528.      Finally, the last part of the pattern matches any additional
  529.      whitespace beyond the minimum needed to end a sentence.
  530.  
  531. 
  532. File: lispref.info,  Node: Regexp Search,  Next: POSIX Regexps,  Prev: Regular Expressions,  Up: Searching and Matching
  533.  
  534. Regular Expression Searching
  535. ============================
  536.  
  537.    In XEmacs, you can search for the next match for a regexp either
  538. incrementally or not.  Incremental search commands are described in the
  539. `The XEmacs Reference Manual'.  *Note Regular Expression Search:
  540. (emacs)Regexp Search.  Here we describe only the search functions
  541. useful in programs.  The principal one is `re-search-forward'.
  542.  
  543.  - Command: re-search-forward REGEXP &optional LIMIT NOERROR REPEAT
  544.      This function searches forward in the current buffer for a string
  545.      of text that is matched by the regular expression REGEXP.  The
  546.      function skips over any amount of text that is not matched by
  547.      REGEXP, and leaves point at the end of the first match found.  It
  548.      returns the new value of point.
  549.  
  550.      If LIMIT is non-`nil' (it must be a position in the current
  551.      buffer), then it is the upper bound to the search.  No match
  552.      extending after that position is accepted.
  553.  
  554.      What happens when the search fails depends on the value of
  555.      NOERROR.  If NOERROR is `nil', a `search-failed' error is
  556.      signaled.  If NOERROR is `t', `re-search-forward' does nothing and
  557.      returns `nil'.  If NOERROR is neither `nil' nor `t', then
  558.      `re-search-forward' moves point to LIMIT (or the end of the
  559.      buffer) and returns `nil'.
  560.  
  561.      If REPEAT is supplied (it must be a positive number), then the
  562.      search is repeated that many times (each time starting at the end
  563.      of the previous time's match).  If these successive searches
  564.      succeed, the function succeeds, moving point and returning its new
  565.      value.  Otherwise the search fails.
  566.  
  567.      In the following example, point is initially before the `T'.
  568.      Evaluating the search call moves point to the end of that line
  569.      (between the `t' of `hat' and the newline).
  570.  
  571.           ---------- Buffer: foo ----------
  572.           I read "-!-The cat in the hat
  573.           comes back" twice.
  574.           ---------- Buffer: foo ----------
  575.           
  576.           (re-search-forward "[a-z]+" nil t 5)
  577.                => 27
  578.           
  579.           ---------- Buffer: foo ----------
  580.           I read "The cat in the hat-!-
  581.           comes back" twice.
  582.           ---------- Buffer: foo ----------
  583.  
  584.  - Command: re-search-backward REGEXP &optional LIMIT NOERROR REPEAT
  585.      This function searches backward in the current buffer for a string
  586.      of text that is matched by the regular expression REGEXP, leaving
  587.      point at the beginning of the first text found.
  588.  
  589.      This function is analogous to `re-search-forward', but they are not
  590.      simple mirror images.  `re-search-forward' finds the match whose
  591.      beginning is as close as possible to the starting point.  If
  592.      `re-search-backward' were a perfect mirror image, it would find the
  593.      match whose end is as close as possible.  However, in fact it
  594.      finds the match whose beginning is as close as possible.  The
  595.      reason is that matching a regular expression at a given spot
  596.      always works from beginning to end, and starts at a specified
  597.      beginning position.
  598.  
  599.      A true mirror-image of `re-search-forward' would require a special
  600.      feature for matching regexps from end to beginning.  It's not
  601.      worth the trouble of implementing that.
  602.  
  603.  - Function: string-match REGEXP STRING &optional START
  604.      This function returns the index of the start of the first match for
  605.      the regular expression REGEXP in STRING, or `nil' if there is no
  606.      match.  If START is non-`nil', the search starts at that index in
  607.      STRING.
  608.  
  609.      For example,
  610.  
  611.           (string-match
  612.            "quick" "The quick brown fox jumped quickly.")
  613.                => 4
  614.           (string-match
  615.            "quick" "The quick brown fox jumped quickly." 8)
  616.                => 27
  617.  
  618.      The index of the first character of the string is 0, the index of
  619.      the second character is 1, and so on.
  620.  
  621.      After this function returns, the index of the first character
  622.      beyond the match is available as `(match-end 0)'.  *Note Match
  623.      Data::.
  624.  
  625.           (string-match
  626.            "quick" "The quick brown fox jumped quickly." 8)
  627.                => 27
  628.           
  629.           (match-end 0)
  630.                => 32
  631.  
  632.  - Function: looking-at REGEXP
  633.      This function determines whether the text in the current buffer
  634.      directly following point matches the regular expression REGEXP.
  635.      "Directly following" means precisely that: the search is
  636.      "anchored" and it can succeed only starting with the first
  637.      character following point.  The result is `t' if so, `nil'
  638.      otherwise.
  639.  
  640.      This function does not move point, but it updates the match data,
  641.      which you can access using `match-beginning' and `match-end'.
  642.      *Note Match Data::.
  643.  
  644.      In this example, point is located directly before the `T'.  If it
  645.      were anywhere else, the result would be `nil'.
  646.  
  647.           ---------- Buffer: foo ----------
  648.           I read "-!-The cat in the hat
  649.           comes back" twice.
  650.           ---------- Buffer: foo ----------
  651.           
  652.           (looking-at "The cat in the hat$")
  653.                => t
  654.  
  655. 
  656. File: lispref.info,  Node: POSIX Regexps,  Next: Search and Replace,  Prev: Regexp Search,  Up: Searching and Matching
  657.  
  658. POSIX Regular Expression Searching
  659. ==================================
  660.  
  661.    The usual regular expression functions do backtracking when necessary
  662. to handle the `\|' and repetition constructs, but they continue this
  663. only until they find *some* match.  Then they succeed and report the
  664. first match found.
  665.  
  666.    This section describes alternative search functions which perform the
  667. full backtracking specified by the POSIX standard for regular expression
  668. matching.  They continue backtracking until they have tried all
  669. possibilities and found all matches, so they can report the longest
  670. match, as required by POSIX.  This is much slower, so use these
  671. functions only when you really need the longest match.
  672.  
  673.    In Emacs versions prior to 19.29, these functions did not exist, and
  674. the functions described above implemented full POSIX backtracking.
  675.  
  676.  - Function: posix-search-forward REGEXP &optional LIMIT NOERROR REPEAT
  677.      This is like `re-search-forward' except that it performs the full
  678.      backtracking specified by the POSIX standard for regular expression
  679.      matching.
  680.  
  681.  - Function: posix-search-backward REGEXP &optional LIMIT NOERROR REPEAT
  682.      This is like `re-search-backward' except that it performs the full
  683.      backtracking specified by the POSIX standard for regular expression
  684.      matching.
  685.  
  686.  - Function: posix-looking-at REGEXP
  687.      This is like `looking-at' except that it performs the full
  688.      backtracking specified by the POSIX standard for regular expression
  689.      matching.
  690.  
  691.  - Function: posix-string-match REGEXP STRING &optional START
  692.      This is like `string-match' except that it performs the full
  693.      backtracking specified by the POSIX standard for regular expression
  694.      matching.
  695.  
  696. 
  697. File: lispref.info,  Node: Search and Replace,  Next: Match Data,  Prev: POSIX Regexps,  Up: Searching and Matching
  698.  
  699. Search and Replace
  700. ==================
  701.  
  702.  - Function: perform-replace FROM-STRING REPLACEMENTS QUERY-FLAG
  703.           REGEXP-FLAG DELIMITED-FLAG &optional REPEAT-COUNT MAP
  704.      This function is the guts of `query-replace' and related commands.
  705.      It searches for occurrences of FROM-STRING and replaces some or
  706.      all of them.  If QUERY-FLAG is `nil', it replaces all occurrences;
  707.      otherwise, it asks the user what to do about each one.
  708.  
  709.      If REGEXP-FLAG is non-`nil', then FROM-STRING is considered a
  710.      regular expression; otherwise, it must match literally.  If
  711.      DELIMITED-FLAG is non-`nil', then only replacements surrounded by
  712.      word boundaries are considered.
  713.  
  714.      The argument REPLACEMENTS specifies what to replace occurrences
  715.      with.  If it is a string, that string is used.  It can also be a
  716.      list of strings, to be used in cyclic order.
  717.  
  718.      If REPEAT-COUNT is non-`nil', it should be an integer.  Then it
  719.      specifies how many times to use each of the strings in the
  720.      REPLACEMENTS list before advancing cyclicly to the next one.
  721.  
  722.      Normally, the keymap `query-replace-map' defines the possible user
  723.      responses for queries.  The argument MAP, if non-`nil', is a
  724.      keymap to use instead of `query-replace-map'.
  725.  
  726.  - Variable: query-replace-map
  727.      This variable holds a special keymap that defines the valid user
  728.      responses for `query-replace' and related functions, as well as
  729.      `y-or-n-p' and `map-y-or-n-p'.  It is unusual in two ways:
  730.  
  731.         * The "key bindings" are not commands, just symbols that are
  732.           meaningful to the functions that use this map.
  733.  
  734.         * Prefix keys are not supported; each key binding must be for a
  735.           single event key sequence.  This is because the functions
  736.           don't use read key sequence to get the input; instead, they
  737.           read a single event and look it up "by hand."
  738.  
  739.    Here are the meaningful "bindings" for `query-replace-map'.  Several
  740. of them are meaningful only for `query-replace' and friends.
  741.  
  742. `act'
  743.      Do take the action being considered--in other words, "yes."
  744.  
  745. `skip'
  746.      Do not take action for this question--in other words, "no."
  747.  
  748. `exit'
  749.      Answer this question "no," and give up on the entire series of
  750.      questions, assuming that the answers will be "no."
  751.  
  752. `act-and-exit'
  753.      Answer this question "yes," and give up on the entire series of
  754.      questions, assuming that subsequent answers will be "no."
  755.  
  756. `act-and-show'
  757.      Answer this question "yes," but show the results--don't advance yet
  758.      to the next question.
  759.  
  760. `automatic'
  761.      Answer this question and all subsequent questions in the series
  762.      with "yes," without further user interaction.
  763.  
  764. `backup'
  765.      Move back to the previous place that a question was asked about.
  766.  
  767. `edit'
  768.      Enter a recursive edit to deal with this question--instead of any
  769.      other action that would normally be taken.
  770.  
  771. `delete-and-edit'
  772.      Delete the text being considered, then enter a recursive edit to
  773.      replace it.
  774.  
  775. `recenter'
  776.      Redisplay and center the window, then ask the same question again.
  777.  
  778. `quit'
  779.      Perform a quit right away.  Only `y-or-n-p' and related functions
  780.      use this answer.
  781.  
  782. `help'
  783.      Display some help, then ask again.
  784.  
  785. 
  786. File: lispref.info,  Node: Match Data,  Next: Searching and Case,  Prev: Search and Replace,  Up: Searching and Matching
  787.  
  788. The Match Data
  789. ==============
  790.  
  791.    XEmacs keeps track of the positions of the start and end of segments
  792. of text found during a regular expression search.  This means, for
  793. example, that you can search for a complex pattern, such as a date in
  794. an Rmail message, and then extract parts of the match under control of
  795. the pattern.
  796.  
  797.    Because the match data normally describe the most recent search only,
  798. you must be careful not to do another search inadvertently between the
  799. search you wish to refer back to and the use of the match data.  If you
  800. can't avoid another intervening search, you must save and restore the
  801. match data around it, to prevent it from being overwritten.
  802.  
  803. * Menu:
  804.  
  805. * Simple Match Data::     Accessing single items of match data,
  806.                 such as where a particular subexpression started.
  807. * Replacing Match::      Replacing a substring that was matched.
  808. * Entire Match Data::     Accessing the entire match data at once, as a list.
  809. * Saving Match Data::     Saving and restoring the match data.
  810.  
  811. 
  812. File: lispref.info,  Node: Simple Match Data,  Next: Replacing Match,  Up: Match Data
  813.  
  814. Simple Match Data Access
  815. ------------------------
  816.  
  817.    This section explains how to use the match data to find out what was
  818. matched by the last search or match operation.
  819.  
  820.    You can ask about the entire matching text, or about a particular
  821. parenthetical subexpression of a regular expression.  The COUNT
  822. argument in the functions below specifies which.  If COUNT is zero, you
  823. are asking about the entire match.  If COUNT is positive, it specifies
  824. which subexpression you want.
  825.  
  826.    Recall that the subexpressions of a regular expression are those
  827. expressions grouped with escaped parentheses, `\(...\)'.  The COUNTth
  828. subexpression is found by counting occurrences of `\(' from the
  829. beginning of the whole regular expression.  The first subexpression is
  830. numbered 1, the second 2, and so on.  Only regular expressions can have
  831. subexpressions--after a simple string search, the only information
  832. available is about the entire match.
  833.  
  834.  - Function: match-string COUNT &optional IN-STRING
  835.      This function returns, as a string, the text matched in the last
  836.      search or match operation.  It returns the entire text if COUNT is
  837.      zero, or just the portion corresponding to the COUNTth
  838.      parenthetical subexpression, if COUNT is positive.  If COUNT is
  839.      out of range, or if that subexpression didn't match anything, the
  840.      value is `nil'.
  841.  
  842.      If the last such operation was done against a string with
  843.      `string-match', then you should pass the same string as the
  844.      argument IN-STRING.  Otherwise, after a buffer search or match,
  845.      you should omit IN-STRING or pass `nil' for it; but you should
  846.      make sure that the current buffer when you call `match-string' is
  847.      the one in which you did the searching or matching.
  848.  
  849.  - Function: match-beginning COUNT
  850.      This function returns the position of the start of text matched by
  851.      the last regular expression searched for, or a subexpression of it.
  852.  
  853.      If COUNT is zero, then the value is the position of the start of
  854.      the entire match.  Otherwise, COUNT specifies a subexpression in
  855.      the regular expresion, and the value of the function is the
  856.      starting position of the match for that subexpression.
  857.  
  858.      The value is `nil' for a subexpression inside a `\|' alternative
  859.      that wasn't used in the match.
  860.  
  861.  - Function: match-end COUNT
  862.      This function is like `match-beginning' except that it returns the
  863.      position of the end of the match, rather than the position of the
  864.      beginning.
  865.  
  866.    Here is an example of using the match data, with a comment showing
  867. the positions within the text:
  868.  
  869.      (string-match "\\(qu\\)\\(ick\\)"
  870.                    "The quick fox jumped quickly.")
  871.                    ;0123456789
  872.           => 4
  873.      
  874.      (match-string 0 "The quick fox jumped quickly.")
  875.           => "quick"
  876.      (match-string 1 "The quick fox jumped quickly.")
  877.           => "qu"
  878.      (match-string 2 "The quick fox jumped quickly.")
  879.           => "ick"
  880.      
  881.      (match-beginning 1)       ; The beginning of the match
  882.           => 4                 ;   with `qu' is at index 4.
  883.      
  884.      (match-beginning 2)       ; The beginning of the match
  885.           => 6                 ;   with `ick' is at index 6.
  886.      
  887.      (match-end 1)             ; The end of the match
  888.           => 6                 ;   with `qu' is at index 6.
  889.      
  890.      (match-end 2)             ; The end of the match
  891.           => 9                 ;   with `ick' is at index 9.
  892.  
  893.    Here is another example.  Point is initially located at the beginning
  894. of the line.  Searching moves point to between the space and the word
  895. `in'.  The beginning of the entire match is at the 9th character of the
  896. buffer (`T'), and the beginning of the match for the first
  897. subexpression is at the 13th character (`c').
  898.  
  899.      (list
  900.        (re-search-forward "The \\(cat \\)")
  901.        (match-beginning 0)
  902.        (match-beginning 1))
  903.          => (9 9 13)
  904.      
  905.      ---------- Buffer: foo ----------
  906.      I read "The cat -!-in the hat comes back" twice.
  907.              ^   ^
  908.              9  13
  909.      ---------- Buffer: foo ----------
  910.  
  911. (In this case, the index returned is a buffer position; the first
  912. character of the buffer counts as 1.)
  913.  
  914. 
  915. File: lispref.info,  Node: Replacing Match,  Next: Entire Match Data,  Prev: Simple Match Data,  Up: Match Data
  916.  
  917. Replacing the Text That Matched
  918. -------------------------------
  919.  
  920.    This function replaces the text matched by the last search with
  921. REPLACEMENT.
  922.  
  923.  - Function: replace-match REPLACEMENT &optional FIXEDCASE LITERAL
  924.           STRING
  925.      This function replaces the text in the buffer (or in STRING) that
  926.      was matched by the last search.  It replaces that text with
  927.      REPLACEMENT.
  928.  
  929.      If you did the last search in a buffer, you should specify `nil'
  930.      for STRING.  Then `replace-match' does the replacement by editing
  931.      the buffer; it leaves point at the end of the replacement text,
  932.      and returns `t'.
  933.  
  934.      If you did the search in a string, pass the same string as STRING.
  935.      Then `replace-match' does the replacement by constructing and
  936.      returning a new string.
  937.  
  938.      If FIXEDCASE is non-`nil', then the case of the replacement text
  939.      is not changed; otherwise, the replacement text is converted to a
  940.      different case depending upon the capitalization of the text to be
  941.      replaced.  If the original text is all upper case, the replacement
  942.      text is converted to upper case.  If the first word of the
  943.      original text is capitalized, then the first word of the
  944.      replacement text is capitalized.  If the original text contains
  945.      just one word, and that word is a capital letter, `replace-match'
  946.      considers this a capitalized first word rather than all upper case.
  947.  
  948.      If `case-replace' is `nil', then case conversion is not done,
  949.      regardless of the value of FIXED-CASE.  *Note Searching and Case::.
  950.  
  951.      If LITERAL is non-`nil', then REPLACEMENT is inserted exactly as
  952.      it is, the only alterations being case changes as needed.  If it
  953.      is `nil' (the default), then the character `\' is treated
  954.      specially.  If a `\' appears in REPLACEMENT, then it must be part
  955.      of one of the following sequences:
  956.  
  957.     `\&'
  958.           `\&' stands for the entire text being replaced.
  959.  
  960.     `\N'
  961.           `\N', where N is a digit, stands for the text that matched
  962.           the Nth subexpression in the original regexp.  Subexpressions
  963.           are those expressions grouped inside `\(...\)'.
  964.  
  965.     `\\'
  966.           `\\' stands for a single `\' in the replacement text.
  967.  
  968. 
  969. File: lispref.info,  Node: Entire Match Data,  Next: Saving Match Data,  Prev: Replacing Match,  Up: Match Data
  970.  
  971. Accessing the Entire Match Data
  972. -------------------------------
  973.  
  974.    The functions `match-data' and `set-match-data' read or write the
  975. entire match data, all at once.
  976.  
  977.  - Function: match-data
  978.      This function returns a newly constructed list containing all the
  979.      information on what text the last search matched.  Element zero is
  980.      the position of the beginning of the match for the whole
  981.      expression; element one is the position of the end of the match
  982.      for the expression.  The next two elements are the positions of
  983.      the beginning and end of the match for the first subexpression,
  984.      and so on.  In general, element
  985.  
  986.      number 2N corresponds to `(match-beginning N)'; and element
  987.  
  988.      number 2N + 1 corresponds to `(match-end N)'.
  989.  
  990.      All the elements are markers or `nil' if matching was done on a
  991.      buffer, and all are integers or `nil' if matching was done on a
  992.      string with `string-match'.  (In Emacs 18 and earlier versions,
  993.      markers were used even for matching on a string, except in the case
  994.      of the integer 0.)
  995.  
  996.      As always, there must be no possibility of intervening searches
  997.      between the call to a search function and the call to `match-data'
  998.      that is intended to access the match data for that search.
  999.  
  1000.           (match-data)
  1001.                =>  (#<marker at 9 in foo>
  1002.                     #<marker at 17 in foo>
  1003.                     #<marker at 13 in foo>
  1004.                     #<marker at 17 in foo>)
  1005.  
  1006.  - Function: set-match-data MATCH-LIST
  1007.      This function sets the match data from the elements of MATCH-LIST,
  1008.      which should be a list that was the value of a previous call to
  1009.      `match-data'.
  1010.  
  1011.      If MATCH-LIST refers to a buffer that doesn't exist, you don't get
  1012.      an error; that sets the match data in a meaningless but harmless
  1013.      way.
  1014.  
  1015.      `store-match-data' is an alias for `set-match-data'.
  1016.  
  1017. 
  1018. File: lispref.info,  Node: Saving Match Data,  Prev: Entire Match Data,  Up: Match Data
  1019.  
  1020. Saving and Restoring the Match Data
  1021. -----------------------------------
  1022.  
  1023.    When you call a function that may do a search, you may need to save
  1024. and restore the match data around that call, if you want to preserve the
  1025. match data from an earlier search for later use.  Here is an example
  1026. that shows the problem that arises if you fail to save the match data:
  1027.  
  1028.      (re-search-forward "The \\(cat \\)")
  1029.           => 48
  1030.      (foo)                   ; Perhaps `foo' does
  1031.                              ;   more searching.
  1032.      (match-end 0)
  1033.           => 61              ; Unexpected result---not 48!
  1034.  
  1035.    You can save and restore the match data with `save-match-data':
  1036.  
  1037.  - Macro: save-match-data BODY...
  1038.      This special form executes BODY, saving and restoring the match
  1039.      data around it.
  1040.  
  1041.    You can use `set-match-data' together with `match-data' to imitate
  1042. the effect of the special form `save-match-data'.  This is useful for
  1043. writing code that can run in Emacs 18.  Here is how:
  1044.  
  1045.      (let ((data (match-data)))
  1046.        (unwind-protect
  1047.            ...   ; May change the original match data.
  1048.          (set-match-data data)))
  1049.  
  1050.    Emacs automatically saves and restores the match data when it runs
  1051. process filter functions (*note Filter Functions::.) and process
  1052. sentinels (*note Sentinels::.).
  1053.  
  1054. 
  1055. File: lispref.info,  Node: Searching and Case,  Next: Standard Regexps,  Prev: Match Data,  Up: Searching and Matching
  1056.  
  1057. Searching and Case
  1058. ==================
  1059.  
  1060.    By default, searches in Emacs ignore the case of the text they are
  1061. searching through; if you specify searching for `FOO', then `Foo' or
  1062. `foo' is also considered a match.  Regexps, and in particular character
  1063. sets, are included: thus, `[aB]' would match `a' or `A' or `b' or `B'.
  1064.  
  1065.    If you do not want this feature, set the variable `case-fold-search'
  1066. to `nil'.  Then all letters must match exactly, including case.  This
  1067. is a buffer-local variable; altering the variable affects only the
  1068. current buffer.  (*Note Intro to Buffer-Local::.)  Alternatively, you
  1069. may change the value of `default-case-fold-search', which is the
  1070. default value of `case-fold-search' for buffers that do not override it.
  1071.  
  1072.    Note that the user-level incremental search feature handles case
  1073. distinctions differently.  When given a lower case letter, it looks for
  1074. a match of either case, but when given an upper case letter, it looks
  1075. for an upper case letter only.  But this has nothing to do with the
  1076. searching functions Lisp functions use.
  1077.  
  1078.  - User Option: case-replace
  1079.      This variable determines whether the replacement functions should
  1080.      preserve case.  If the variable is `nil', that means to use the
  1081.      replacement text verbatim.  A non-`nil' value means to convert the
  1082.      case of the replacement text according to the text being replaced.
  1083.  
  1084.      The function `replace-match' is where this variable actually has
  1085.      its effect.  *Note Replacing Match::.
  1086.  
  1087.  - User Option: case-fold-search
  1088.      This buffer-local variable determines whether searches should
  1089.      ignore case.  If the variable is `nil' they do not ignore case;
  1090.      otherwise they do ignore case.
  1091.  
  1092.  - Variable: default-case-fold-search
  1093.      The value of this variable is the default value for
  1094.      `case-fold-search' in buffers that do not override it.  This is the
  1095.      same as `(default-value 'case-fold-search)'.
  1096.  
  1097. 
  1098. File: lispref.info,  Node: Standard Regexps,  Prev: Searching and Case,  Up: Searching and Matching
  1099.  
  1100. Standard Regular Expressions Used in Editing
  1101. ============================================
  1102.  
  1103.    This section describes some variables that hold regular expressions
  1104. used for certain purposes in editing:
  1105.  
  1106.  - Variable: page-delimiter
  1107.      This is the regexp describing line-beginnings that separate pages.
  1108.      The default value is `"^\014"' (i.e., `"^^L"' or `"^\C-l"'); this
  1109.      matches a line that starts with a formfeed character.
  1110.  
  1111.    The following two regular expressions should *not* assume the match
  1112. always starts at the beginning of a line; they should not use `^' to
  1113. anchor the match.  Most often, the paragraph commands do check for a
  1114. match only at the beginning of a line, which means that `^' would be
  1115. superfluous.  When there is a nonzero left margin, they accept matches
  1116. that start after the left margin.  In that case, a `^' would be
  1117. incorrect.  However, a `^' is harmless in modes where a left margin is
  1118. never used.
  1119.  
  1120.  - Variable: paragraph-separate
  1121.      This is the regular expression for recognizing the beginning of a
  1122.      line that separates paragraphs.  (If you change this, you may have
  1123.      to change `paragraph-start' also.)  The default value is
  1124.      `"[ \t\f]*$"', which matches a line that consists entirely of
  1125.      spaces, tabs, and form feeds (after its left margin).
  1126.  
  1127.  - Variable: paragraph-start
  1128.      This is the regular expression for recognizing the beginning of a
  1129.      line that starts *or* separates paragraphs.  The default value is
  1130.      `"[ \t\n\f]"', which matches a line starting with a space, tab,
  1131.      newline, or form feed (after its left margin).
  1132.  
  1133.  - Variable: sentence-end
  1134.      This is the regular expression describing the end of a sentence.
  1135.      (All paragraph boundaries also end sentences, regardless.)  The
  1136.      default value is:
  1137.  
  1138.           "[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*"
  1139.  
  1140.      This means a period, question mark or exclamation mark, followed
  1141.      optionally by a closing parenthetical character, followed by tabs,
  1142.      spaces or new lines.
  1143.  
  1144.      For a detailed explanation of this regular expression, see *Note
  1145.      Regexp Example::.
  1146.  
  1147. 
  1148. File: lispref.info,  Node: Syntax Tables,  Next: Abbrevs,  Prev: Searching and Matching,  Up: Top
  1149.  
  1150. Syntax Tables
  1151. *************
  1152.  
  1153.    A "syntax table" specifies the syntactic textual function of each
  1154. character.  This information is used by the parsing commands, the
  1155. complex movement commands, and others to determine where words, symbols,
  1156. and other syntactic constructs begin and end.  The current syntax table
  1157. controls the meaning of the word motion functions (*note Word Motion::.)
  1158. and the list motion functions (*note List Motion::.) as well as the
  1159. functions in this chapter.
  1160.  
  1161. * Menu:
  1162.  
  1163. * Basics: Syntax Basics.     Basic concepts of syntax tables.
  1164. * Desc: Syntax Descriptors.  How characters are classified.
  1165. * Syntax Table Functions::   How to create, examine and alter syntax tables.
  1166. * Motion and Syntax::         Moving over characters with certain syntaxes.
  1167. * Parsing Expressions::      Parsing balanced expressions
  1168.                                 using the syntax table.
  1169. * Standard Syntax Tables::   Syntax tables used by various major modes.
  1170. * Syntax Table Internals::   How syntax table information is stored.
  1171.  
  1172.